package whu.hami.tea;

import android.app.Activity;
import android.app.Application;
import android.content.SharedPreferences;

import java.util.ArrayList;

/**
 * Created by pendragon on 17-5-27.
 */

public class TeaApplication extends Application {

    private ArrayList<Activity> activityList;
    private SharedPreferences sp;

    @Override
    public void onCreate() {
        super.onCreate();

        sp = getSharedPreferences("user", MODE_PRIVATE);
    }

    public SharedPreferences getSharedPreferences(){
        return sp;
    }

    public void addToList(Activity activity){
        if (activityList == null)
            activityList = new ArrayList<>();

        activityList.add(activity);
    }

    public void finishAllActivity(){
        for (Activity e : activityList)
            e.finish();
    }
}
